<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>递归附加参数的使用</title>
</head>
<body>
    <script>
        let lessons = [
            {
                lesson : "css",
                click : 33
            },
            {
                lesson : "html",
                click : 53
            },
            {
                lesson : "js",
                click : 66
            },
            {
                lesson : "vue",
                click : 44
            },
        ];

        function addClick(lessons,num,i = 0) {
            if(i == lessons.length){
                return lessons;
            };
            lessons[i].click += num;
            return addClick(lessons,num,++i);
        };

        console.table(addClick(lessons,100));


        // 相当于
        // lessons = lessons.map((item) => {
        //     item.click += 100;
        //     return item;
        // })
        // console.table(lessons);
    </script>
</body>
</html>